<script setup>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
import HelloWorld from './components/HelloWorld.vue'
import { ref } from 'vue'

const mode = import.meta.env.MODE;

// const host = mode === 'development' ? 'http://127.0.0.1:7001' : 'http://www.k8s-demo-local.com'
const host = mode === 'development' ? 'http://127.0.0.1:7001' : 'http://192.168.87.134:30636'
const message = ref('')

fetch(`${ host }/say-hello`)
    .then(response => {
      return response.json()
    })
    .then(data => {
      message.value = JSON.stringify(data)
    })
    .catch((err) => {
      console.error('fetch error:', err)
    })
</script>

<template>
  <img alt="Vue logo" src="./assets/logo.png"/>
  <br>
  {{ message }}
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
